load("@fbcode//buck2:proto_defs.bzl", "rust_protobuf_library")
load("@fbsource//tools/build_defs:glob_defs.bzl", "glob")

oncall("buck2")

rust_protobuf_library(
    name = "buck2_cli_proto",
    srcs = glob(["src/**/*.rs"]),
    build_env = {
        "BUCK_HACK_DATA_PROTOC_INCLUDE": "$(location //buck2/app/buck2_data:data.proto)",
        "BUCK_HACK_SUBSCRIPTION_PROTOC_INCLUDE": "$(location //buck2/app/buck2_subscription_proto:subscription.proto)",
    },
    build_script = "build.rs",
    doctests = False,  # FIXME
    protos = ["daemon.proto"],
    test_deps = [
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:tokio",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:prost-types",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio-util",
        "//buck2/allocative/allocative:allocative",
        "//buck2/app/buck2_data:buck2_data",
        "//buck2/app/buck2_subscription_proto:buck2_subscription_proto",
    ],
)
